/*
 *
 *  * Copyright (c) 2016. For Intelligent Group.
 *
 */

package com.intelligent.ispc.utils;

import com.intelligent.ispc.event.TaskProcessChangeEvent;
import com.intelligent.ispc.event.TaskProcessUrlEvent;

/**
 * Created by Peter on 2016/9/20.
 */
public class ProcessHelper {
    private String key;

    /**
     * Constructor.
     *
     * @param key process key
     */
    public ProcessHelper(String key) {
        this.key = key;
    }

    /**
     * Post the process details as a Server Event.
     *
     * @param present process present
     * @param log     log
     */
    public void postProcess(int present, String log) {
        ServerEventBusUtils.post(new TaskProcessChangeEvent(key, present, log));
    }

    /**
     * Post the process details as a Server Event.
     *
     * @param url target url
     */
    public void postProcess(String url) {
        ServerEventBusUtils.post(new TaskProcessUrlEvent(key, url));
    }
}
